package com.olda.play.system.service.impl;

import cn.hutool.core.lang.Assert;
import com.olda.play.rpc.CommonResponseDto;
import com.olda.play.system.biz.SysOauthClientBizService;
import com.olda.play.system.dto.SysOauthClientDto;
import com.olda.play.system.service.SysOauthClientService;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

/**
 */
@Service
@RestController
public class SysOauthClientServiceImpl implements SysOauthClientService {

    @Autowired
    private SysOauthClientBizService sysOauthClientBizService;

    /**
     * 根据id获取OAuth2客户端认证信息
     * @param clientId
     * @return
     */
    @Override
    public CommonResponseDto<SysOauthClientDto> selectOAuth2ClientById(String clientId) {
        //查询用户信息
        SysOauthClientDto sysOauthClientDto=sysOauthClientBizService.selectOAuth2ClientById(clientId);
        Assert.isTrue(sysOauthClientDto != null, "OAuth2 客户端不存在");
        return CommonResponseDto.success(sysOauthClientDto);
    }
}
